import 'dart:convert';
import 'dart:async';
import 'package:http/http.dart' as http;
//import 'package:flutterxc/module/Home_module.dart';
import 'package:flutterxc/module/search_module.dart';
//const HOME_URL = 'http://www.devio.org/io/flutter_app/json/home_page.json';
class SearchDao {
//  final String Url ;
//  SearchDao(this.Url);
  static Future<SearchModel>fetch(String url,{val})async {
    final response = await http.get(url);
      if(response.statusCode == 200){
        var res = json.decode(Utf8Decoder().convert(response.bodyBytes));
//        print('$res res666');
        SearchModel model = SearchModel.fromJson(res);
        model.keyword = val;
        return model;
      }else {
        throw Exception('一个未知的错误');
      }
  }
}